package com.worthtech.billportal.bean.base;

import java.io.Serializable;


/**
 * This is an object that contains data related to the acl_user table.
 * Do not modify this class because it will be overwritten if the configuration file
 * related to this class is modified.
 *
 * @hibernate.class
 *  table="acl_user"
 */

public abstract class BaseUser  implements Serializable {

	public static String REF = "User";
	public static String PROP_REMARK = "Remark";
	public static String PROP_ORGANIZATION = "organization";
	public static String PROP_TELEPHONE = "Telephone";
	public static String PROP_USER_ID = "UserId";
	public static String PROP_ORGANIZATION_CODE = "OrganizationCode";
	public static String PROP_PASSWORD = "Password";
	public static String PROP_EMAIL = "Email";
	public static String PROP_FAX = "Fax";
	public static String PROP_LASTLOGOUTTIME = "Lastlogouttime";
	public static String PROP_LASTLOGINTIME = "Lastlogintime";
	public static String PROP_REG_DATE = "RegDate";
	public static String PROP_NAME = "Name";
	public static String PROP_ID = "Id";


	// constructors
	public BaseUser () {
		initialize();
	}

	/**
	 * Constructor for primary key
	 */
	public BaseUser (java.lang.Integer id) {
		this.setId(id);
		initialize();
	}

	protected void initialize () {}



	private int hashCode = Integer.MIN_VALUE;

	// primary key
	private java.lang.Integer id;

	// fields
	private java.lang.String userId;
	private java.lang.String name;
	private java.lang.String password;
	private java.lang.String telephone;
	private java.lang.Integer fax;
	private java.lang.String email;
	private java.util.Date lastlogintime;
	private java.util.Date lastlogouttime;
	private java.lang.String organizationCode;
	private java.lang.String remark;
	private java.util.Date regDate;

	// many to one
	private com.worthtech.billportal.bean.Organization organization;

	// collections
	private java.util.Set<com.worthtech.billportal.bean.Role> roles;



	/**
	 * Return the unique identifier of this class
     * @hibernate.id
     *  generator-class="native"
     *  column="id"
     */
	public java.lang.Integer getId () {
		return id;
	}

	/**
	 * Set the unique identifier of this class
	 * @param id the new ID
	 */
	public void setId (java.lang.Integer id) {
		this.id = id;
		this.hashCode = Integer.MIN_VALUE;
	}




	/**
	 * Return the value associated with the column: userId
	 */
	public java.lang.String getUserId () {
		return userId;
	}

	/**
	 * Set the value related to the column: userId
	 * @param userId the userId value
	 */
	public void setUserId (java.lang.String userId) {
		this.userId = userId;
	}



	/**
	 * Return the value associated with the column: name
	 */
	public java.lang.String getName () {
		return name;
	}

	/**
	 * Set the value related to the column: name
	 * @param name the name value
	 */
	public void setName (java.lang.String name) {
		this.name = name;
	}



	/**
	 * Return the value associated with the column: password
	 */
	public java.lang.String getPassword () {
		return password;
	}

	/**
	 * Set the value related to the column: password
	 * @param password the password value
	 */
	public void setPassword (java.lang.String password) {
		this.password = password;
	}



	/**
	 * Return the value associated with the column: telephone
	 */
	public java.lang.String getTelephone () {
		return telephone;
	}

	/**
	 * Set the value related to the column: telephone
	 * @param telephone the telephone value
	 */
	public void setTelephone (java.lang.String telephone) {
		this.telephone = telephone;
	}



	/**
	 * Return the value associated with the column: fax
	 */
	public java.lang.Integer getFax () {
		return fax;
	}

	/**
	 * Set the value related to the column: fax
	 * @param fax the fax value
	 */
	public void setFax (java.lang.Integer fax) {
		this.fax = fax;
	}



	/**
	 * Return the value associated with the column: email
	 */
	public java.lang.String getEmail () {
		return email;
	}

	/**
	 * Set the value related to the column: email
	 * @param email the email value
	 */
	public void setEmail (java.lang.String email) {
		this.email = email;
	}



	/**
	 * Return the value associated with the column: lastlogintime
	 */
	public java.util.Date getLastlogintime () {
		return lastlogintime;
	}

	/**
	 * Set the value related to the column: lastlogintime
	 * @param lastlogintime the lastlogintime value
	 */
	public void setLastlogintime (java.util.Date lastlogintime) {
		this.lastlogintime = lastlogintime;
	}



	/**
	 * Return the value associated with the column: lastlogouttime
	 */
	public java.util.Date getLastlogouttime () {
		return lastlogouttime;
	}

	/**
	 * Set the value related to the column: lastlogouttime
	 * @param lastlogouttime the lastlogouttime value
	 */
	public void setLastlogouttime (java.util.Date lastlogouttime) {
		this.lastlogouttime = lastlogouttime;
	}



	/**
	 * Return the value associated with the column: organizationCode
	 */
	public java.lang.String getOrganizationCode () {
		return organizationCode;
	}

	/**
	 * Set the value related to the column: organizationCode
	 * @param organizationCode the organizationCode value
	 */
	public void setOrganizationCode (java.lang.String organizationCode) {
		this.organizationCode = organizationCode;
	}



	/**
	 * Return the value associated with the column: remark
	 */
	public java.lang.String getRemark () {
		return remark;
	}

	/**
	 * Set the value related to the column: remark
	 * @param remark the remark value
	 */
	public void setRemark (java.lang.String remark) {
		this.remark = remark;
	}



	/**
	 * Return the value associated with the column: regDate
	 */
	public java.util.Date getRegDate () {
		return regDate;
	}

	/**
	 * Set the value related to the column: regDate
	 * @param regDate the regDate value
	 */
	public void setRegDate (java.util.Date regDate) {
		this.regDate = regDate;
	}



	/**
	 * Return the value associated with the column: organizationCode
	 */
	public com.worthtech.billportal.bean.Organization getOrganization () {
		return organization;
	}

	/**
	 * Set the value related to the column: organizationCode
	 * @param organization the organizationCode value
	 */
	public void setOrganization (com.worthtech.billportal.bean.Organization organization) {
		this.organization = organization;
	}



	/**
	 * Return the value associated with the column: roles
	 */
	public java.util.Set<com.worthtech.billportal.bean.Role> getRoles () {
		return roles;
	}

	/**
	 * Set the value related to the column: roles
	 * @param roles the roles value
	 */
	public void setRoles (java.util.Set<com.worthtech.billportal.bean.Role> roles) {
		this.roles = roles;
	}

	public void addToroles (com.worthtech.billportal.bean.Role role) {
		if (null == getRoles()) setRoles(new java.util.TreeSet<com.worthtech.billportal.bean.Role>());
		getRoles().add(role);
	}




	public boolean equals (Object obj) {
		if (null == obj) return false;
		if (!(obj instanceof com.worthtech.billportal.bean.User)) return false;
		else {
			com.worthtech.billportal.bean.User user = (com.worthtech.billportal.bean.User) obj;
			if (null == this.getId() || null == user.getId()) return false;
			else return (this.getId().equals(user.getId()));
		}
	}

	public int hashCode () {
		if (Integer.MIN_VALUE == this.hashCode) {
			if (null == this.getId()) return super.hashCode();
			else {
				String hashStr = this.getClass().getName() + ":" + this.getId().hashCode();
				this.hashCode = hashStr.hashCode();
			}
		}
		return this.hashCode;
	}


	public String toString () {
		return super.toString();
	}


}